<template>
  <div>
    <ZgEdit
      ref="dialog"
      :columns="columns"
      :formulas="formulas"
      validUrl=""
      saveUrl="/zg-message/message/template/add"
      @ok="ok">
    </ZgEdit>
  </div>
</template>
<script>
export default {
  data () {
    return {
      columns: [
        { name: '标题', code: 'title', compType: '单行文本', isNeed: true, offset: 0, span: 24, defaultVal: '', regex: '', errorMsg: '' },
        { name: '类型', code: 'type', compType: '下拉选择', isNeed: true, offset: 0, span: 24, defaultVal: 'SMS', extra: { 下拉选项: [{ value: 'sms', label: '短信' }, { value: 'email', label: '邮件' }, { value: 'inbox', label: '站内信' }] } },
        { name: '内容', code: 'content', compType: '多行文本', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { 行数: 3 } },
        { name: '备注', code: 'memo', compType: '多行文本', isNeed: false, offset: 0, span: 24, defaultVal: '', extra: { 行数: 4 } }
      ],
      formulas: [
        { triggerMode: '初始化时', name: '公式1', content: 'console.log("init");' },
        { triggerMode: '数据变化时', name: '公式2', content: 'console.log("update");' },
        { triggerMode: '提交时', name: '公式3', content: 'console.log("submit");' }
      ]
    }
  },
  methods: {
    open () {
      this.$refs.dialog.open()
    },
    ok () {
      this.$emit('ok')
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
